package com.cskaoyan.mall.service;

import com.cskaoyan.mall.dao.OrderDao;
import com.cskaoyan.mall.dao.OrderDaoImpl;
import com.cskaoyan.mall.model.Order;
import com.cskaoyan.mall.model.OrderRequestParam;
import com.cskaoyan.mall.model.OrderResponse;

import java.util.List;

/**
 * @PackgeName: com.cskaoyan.mall.service
 * @ClassName: OrderServiceImpl
 * @Author: admin
 * Date: 2020/5/5 20:29
 * project name: Javaproject1
 * @Version:
 * @Description:
 */
public class OrderServiceImpl implements OrderService {

    private OrderDao orderDao = new OrderDaoImpl();

    @Override
    public OrderResponse orderByPage(OrderRequestParam param) {
        //多条件查询
        //查询两次 第一次根据条件查出total
        Integer total = orderDao.getTotal(param);
        //根据条件查出具体的订单数据
        List<Order> orderList = orderDao.orderByPage(param);
        OrderResponse orderResponse = new OrderResponse();

        orderResponse.setTotal(total);
        orderResponse.setOrders(orderList);

        return orderResponse;
    }
}
